package com.xzl.org.learning_situation_analysis.service.Impl;

import com.github.pagehelper.PageInfo;
import com.xzl.org.learning_situation_analysis.dao.GradeMapper;
import com.xzl.org.learning_situation_analysis.entity.Grade;
import com.xzl.org.learning_situation_analysis.entity.User;
import com.xzl.org.learning_situation_analysis.service.GradeService;
import com.xzl.org.learning_situation_analysis.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 夏智力
 * @FileName GradeServiceImpl
 * @date 2022/4/20 22:11
 * @Software: IntelliJ IDEA
 */
@Service
public class GradeServiceImpl implements GradeService {

    @Autowired
    private GradeMapper gradeMapper;

    @Override
    public int insertGrade(Grade grade) {
        return gradeMapper.insertGrade(grade);
    }

    @Override
    public int delGrade(int id) {
        return gradeMapper.delGrade(id);
    }

    @Override
    public PageInfo<Grade> selectCurrentPageGrade(int currentPage, int pageSize) {
        List<Grade> gradeAll = gradeMapper.selectAll();
        PageInfo page = new PageUtil<Grade>().getPage(currentPage, pageSize, gradeAll);
        return page;
    }

}
